package cn.school;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import cn.school.util.DBUtil;

public class GetStu {

	public static void main(String[] args) {
		String sql = "select * from s_student order by stuno asc";
		try (Connection con = DBUtil.getConnection();
				PreparedStatement ps = con.prepareStatement(sql);
				ResultSet rs = ps.executeQuery();) {

			for (int i = 1; i <= 10; i++)
				rs.next();
			System.out.println("第十行:");
			System.out.println(rs.getLong("stuno") + "," + rs.getString("sname"));
			rs.previous();
			rs.previous();
			System.out.println("第八行:");
			System.out.println(rs.getLong("stuno") + "," + rs.getString("sname"));

		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
